<include file="Public/min-header" />
<div class="wrapper">
    <include file="Public/breadcrumb" />
    <section class="content">
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i> 应用列表</h3>
                </div>
                <div class="panel-body">
                    <form method="post" id="addEditGoodsForm">
                        <div class="tab-pane" id="tab_function">
                            <div class="row">
                                <volist name="list" id="v">
                                    <div class="col-sm-2" style="width:260px;margin-top: 10px;">
                                        <div class="thumbnail">
                                            <img style="width:150px; height:60px;" src="/Public/application/{$v.code}/{$v.icon}">
                                            <div class="caption">
                                                <h4>{$v.name}</h4>
                                                <p>{$v.desc}</p>
                                                <if condition="$v.status eq 0">
                                                    <p><a onclick="installApp('{$v.code}', 1)" href="#" class="btn btn-primary" role="button">一键安装</a> </p>
                                                    <else />
                                                    <p>
                                                        <a onclick="installApp('{$v.code}', 0)" href="#" class="btn btn-danger" role="button">卸载</a>
                                                    </p>
                                                </if>
                                            </div>
                                        </div>
                                    </div>
                                </volist>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
</div>
<script>
//插件安装(卸载)
    function installApp(code, type) {
        var url = '/index.php?m=Admin&c=Application&a=install&code=' + code + '&install=' + type;
        $.get(url, function (data) {
            var obj = JSON.parse(data);
            alert(obj.msg);
            //layer.alert(obj.msg, {icon: 2});  
            if (obj.status == 1) {
                parent.location.reload();
            }
        })
    }
</script>
</body>

</html>
